####################################
# Validity checks 
####################################

rm(list=ls())

#sink("~/Dropbox/Crime Chile/11_replication/04_falsification_test_crime.txt")

library(Hmisc)
library(ggplot2)
library(stargazer)
library(foreign)
library(rdrobust)
library(rdd)
library(readstata13)

################
# Prepare data 
################

# read data
d = read.dta13("~/Dropbox/Crime Chile/11_replication/local_crime_data_chile_2022january.dta")   
names(d)

######################
# Figure
######################

# unemployment 2003
h1 = rdbwselect(d$unemployment_2003_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1p.pdf", 
          width=7, 
          height=7)
rdplot(y = d$unemployment_2003_s, x = d$margin, h= h1, nbins = 100, subset = -h1 <= d$margin & d$margin <= h1,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.331 , 0.177]",
       y.label = "Unemployment", x.label = "Margin of victory")
dev.off() 

# wage 2003
h2 = rdbwselect(d$wage_2003_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1q.pdf", 
          width=7, 
          height=7)
rdplot(y = d$wage_2003_s, x = d$margin, h= h2, nbins = 100, subset = -h2 <= d$margin & d$margin <= h2,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.107 , 0.191]",
       y.label = "Wage income", x.label = "Margin of victory")
dev.off() 

# inequality 2003
h3 = rdbwselect(d$inequality_2003_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1r.pdf", 
          width=7, 
          height=7)
rdplot(y = d$inequality_2003_s, x = d$margin, h= h3, nbins = 100, subset = -h3 <= d$margin & d$margin <= h3,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.100 , 0.373]",
       y.label = "Income inequality", x.label = "Margin of victory")
dev.off() 

# lag homicide
h4 = rdbwselect(d$lag_homicide_rate_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1t.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_homicide_rate_s, x = d$margin, h= h4, nbins = 100, subset = -h4 <= d$margin & d$margin <= h4,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.207 , 0.169]",
       y.label = "Lag homicide", x.label = "Margin of victory")
dev.off() 

# lag rape
h5 = rdbwselect(d$lag_rape_rate_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1u.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_rape_rate_s, x = d$margin, h= h5, nbins = 100, subset = -h5 <= d$margin & d$margin <= h5,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.185 , 0.388]",
       y.label = "Lag rape", x.label = "Margin of victory")
dev.off() 

# lag assault
h6 = rdbwselect(d$lag_assault_rate_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1v.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_assault_rate_s, x = d$margin, h= h6, nbins = 100, subset = -h6 <= d$margin & d$margin <= h6,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.364 , 0.695]",
       y.label = "Lag assault", x.label = "Margin of victory")
dev.off() 

# lag theft
h7 = rdbwselect(d$lag_theft_rate_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1w.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_theft_rate_s, x = d$margin, h= h7, nbins = 100, subset = -h7 <= d$margin & d$margin <= h7,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.681 , 0.443]",
       y.label = "Lag theft", x.label = "Margin of victory")
dev.off() 

# lag robbery
h8 = rdbwselect(d$lag_robbery_rate_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1x.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_robbery_rate_s, x = d$margin, h= h8, nbins = 100, subset = -h8 <= d$margin & d$margin <= h8,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.519 , 0.359]",
       y.label = "Lag robbery", x.label = "Margin of victory")
dev.off() 

# lag robbery by surprise
h9 = rdbwselect(d$lag_robbery_surprise_rate_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1y.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_robbery_surprise_rate_s, x = d$margin, h= h9, nbins = 100, subset = -h9 <= d$margin & d$margin <= h9,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.949 , 0.389]",
       y.label = "Lag robbery by surprise", x.label = "Margin of victory")
dev.off() 

# lag fndr security 
h10 = rdbwselect(d$lag_fndr_selected_ares_dflctr_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1s.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lag_fndr_selected_ares_dflctr_s, x = d$margin, h= h10, nbins = 100, subset = -h10 <= d$margin & d$margin <= h10,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title = "                                       Robust CI: [-0.100 , 0.111]",
       y.label = "Lag FNDR security", x.label = "Margin of victory")
dev.off() 

# capital
h11 = rdbwselect(d$capitalprovince_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1a.pdf", 
          width=7, 
          height=7)
rdplot(y = d$capitalprovince_s, x = d$margin, h= h11, nbins = 100, subset = -h11 <= d$margin & d$margin <= h11,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.173 , 0.447]",
       y.label = "Capital", x.label = "Margin of victory")
dev.off() 

# code region
h12 = rdbwselect(d$coderegion_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1b.pdf", 
          width=7, 
          height=7)
rdplot(y = d$coderegion_s, x = d$margin, h= h12, nbins = 100, subset = -h12 <= d$margin & d$margin <= h12,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.090 , 0.304]",
       y.label = "Region", x.label = "Margin of victory")
dev.off() 

# code province
h13 = rdbwselect(d$codeprovince_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1c.pdf", 
          width=7, 
          height=7)
rdplot(y = d$codeprovince_s, x = d$margin, h= h13, nbins = 100, subset = -h13 <= d$margin & d$margin <= h13,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.085 , 0.303]",
       y.label = "Province", x.label = "Margin of victory")
dev.off() 

# area
h14 = rdbwselect(d$area_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1d.pdf", 
          width=7, 
          height=7)
rdplot(y = d$area_s, x = d$margin, h= h14, nbins = 100, subset = -h14 <= d$margin & d$margin <= h14,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.325 , 0.235]",
       y.label = "Area", x.label = "Margin of victory")
dev.off() 

# population
h15 = rdbwselect(d$logpop02_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1e.pdf", 
          width=7, 
          height=7)
rdplot(y = d$logpop02_s, x = d$margin, h= h15, nbins = 100, subset = -h15 <= d$margin & d$margin <= h15,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.468 , 0.201]",
       y.label = "Population", x.label = "Margin of victory")
dev.off() 

# urban
h16 = rdbwselect(d$urbano02_p_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1f.pdf", 
          width=7, 
          height=7)
rdplot(y = d$urbano02_p_s, x = d$margin, h= h16, nbins = 100, subset = -h16 <= d$margin & d$margin <= h16,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.323 , 0.330]",
       y.label = "Urban", x.label = "Margin of victory")
dev.off() 

# literacy
h17 = rdbwselect(d$alfab03_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1g.pdf", 
          width=7, 
          height=7)
rdplot(y = d$alfab03_s, x = d$margin, h= h17, nbins = 100, subset = -h17 <= d$margin & d$margin <= h17,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.582 , 0.122]]",
       y.label = "Literacy", x.label = "Margin of victory")
dev.off() 

# income
h18 = rdbwselect(d$ingresopercapita03_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1h.pdf", 
          width=7, 
          height=7)
rdplot(y = d$ingresopercapita03_s, x = d$margin, h= h18, nbins = 100, subset = -h18 <= d$margin & d$margin <= h18,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.325 , 0.135]",
       y.label = "Income", x.label = "Margin of victory")
dev.off() 

# idh
h19 = rdbwselect(d$idh03_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1i.pdf", 
          width=7, 
          height=7)
rdplot(y = d$idh03_s, x = d$margin, h= h19, nbins = 100, subset = -h19 <= d$margin & d$margin <= h19,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.441 , 0.117]]",
       y.label = "HDI", x.label = "Margin of victory")
dev.off() 

# rank idh
h20 = rdbwselect(d$rankidh03_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1j.pdf", 
          width=7, 
          height=7)
rdplot(y = d$rankidh03_s, x = d$margin, h= h20, nbins = 100, subset = -h20 <= d$margin & d$margin <= h20,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.203 , 0.413]",
       y.label = "HDR", x.label = "Margin of victory")
dev.off() 

# votes
h21 = rdbwselect(d$logpresvotes1999_1_all_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1k.pdf", 
          width=7, 
          height=7)
rdplot(y = d$logpresvotes1999_1_all_s, x = d$margin, h= h21, nbins = 100, subset = -h21 <= d$margin & d$margin <= h21,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.457 , 0.228]",
       y.label = "Votes", x.label = "Margin of victory")
dev.off() 

# lavin
h22 = rdbwselect(d$lavin99_p_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1l.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lavin99_p_s, x = d$margin, h= h22, nbins = 100, subset = -h22 <= d$margin & d$margin <= h22,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.160 , 0.225]",
       y.label = "Right-wing", x.label = "Margin of victory")
dev.off() 

# lagos
h23 = rdbwselect(d$lagos99_p_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1m.pdf", 
          width=7, 
          height=7)
rdplot(y = d$lagos99_p_s, x = d$margin, h= h23, nbins = 100, subset = -h23 <= d$margin & d$margin <= h23,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.234 , 0.177]",
       y.label = "Left-wing", x.label = "Margin of victory")
dev.off() 

# invalid
h24 = rdbwselect(d$nulo99_p_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1n.pdf", 
          width=7, 
          height=7)
rdplot(y = d$nulo99_p_s, x = d$margin, h= h24, nbins = 100, subset = -h24 <= d$margin & d$margin <= h24,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.048 , 0.532]",
       y.label = "Invalid", x.label = "Margin of victory")
dev.off() 

# blank
h25 = rdbwselect(d$blanco99_p_s,d$margin,cluster = d$cluster)$bws[1]
cairo_pdf(file="~/Dropbox/Crime Chile/11_replication/figureA1o.pdf", 
          width=7, 
          height=7)
rdplot(y = d$blanco99_p_s, x = d$margin, h= h25, nbins = 100, subset = -h25 <= d$margin & d$margin <= h25,
       binselect="esmv", kernel="triangular", col.lines = "black", col.dots = "black", p=1, y.lim = c(-1, 1), title =                                        "Robust CI: [-0.153 , 0.355]",
       y.label = "Blank", x.label = "Margin of victory")
dev.off() 

######################
# Table
######################

summary(rdrobust(d$capitalprovince_s,d$margin,cluster = d$cluster,all=TRUE))
pe1 = as.numeric(rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv1 = as.numeric(rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci1 = as.numeric(rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss1 = as.numeric(rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess1 = as.numeric(rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw1 = as.numeric(rdrobust(d$capitalprovince_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$coderegion_s,d$margin,cluster = d$cluster,all=TRUE))
pe2 = as.numeric(rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv2 = as.numeric(rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci2 = as.numeric(rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss2 = as.numeric(rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess2 = as.numeric(rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw2 = as.numeric(rdrobust(d$coderegion_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$codeprovince_s,d$margin,cluster = d$cluster,all=TRUE))
pe3 = as.numeric(rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv3 = as.numeric(rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci3 = as.numeric(rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss3 = as.numeric(rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess3 = as.numeric(rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw3 = as.numeric(rdrobust(d$codeprovince_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$area_s,d$margin,cluster = d$cluster,all=TRUE))
pe4 = as.numeric(rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv4 = as.numeric(rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci4 = as.numeric(rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss4 = as.numeric(rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess4 = as.numeric(rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw4 = as.numeric(rdrobust(d$area_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$logpop02_s,d$margin,cluster = d$cluster,all=TRUE))
pe5 = as.numeric(rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv5 = as.numeric(rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci5 = as.numeric(rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss5 = as.numeric(rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess5 = as.numeric(rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw5 = as.numeric(rdrobust(d$logpop02_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$urbano02_p_s,d$margin,cluster = d$cluster,all=TRUE))
pe6 = as.numeric(rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv6 = as.numeric(rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci6 = as.numeric(rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss6 = as.numeric(rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess6 = as.numeric(rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw6 = as.numeric(rdrobust(d$urbano02_p_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$alfab03_s,d$margin,cluster = d$cluster,all=TRUE))
pe7 = as.numeric(rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv7 = as.numeric(rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci7 = as.numeric(rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss7 = as.numeric(rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess7 = as.numeric(rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw7 = as.numeric(rdrobust(d$alfab03_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$ingresopercapita03_s,d$margin,cluster = d$cluster,all=TRUE))
pe8 = as.numeric(rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv8 = as.numeric(rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci8 = as.numeric(rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss8 = as.numeric(rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess8 = as.numeric(rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw8 = as.numeric(rdrobust(d$ingresopercapita03_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$idh03_s,d$margin,cluster = d$cluster,all=TRUE))
pe9 = as.numeric(rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv9 = as.numeric(rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci9 = as.numeric(rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss9 = as.numeric(rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess9 = as.numeric(rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw9 = as.numeric(rdrobust(d$idh03_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$rankidh03_s,d$margin,cluster = d$cluster,all=TRUE))
pe10 = as.numeric(rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv10 = as.numeric(rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci10 = as.numeric(rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss10 = as.numeric(rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess10 = as.numeric(rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw10 = as.numeric(rdrobust(d$rankidh03_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$logpresvotes1999_1_all_s,d$margin,cluster = d$cluster,all=TRUE))
pe11 = as.numeric(rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv11 = as.numeric(rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci11 = as.numeric(rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss11 = as.numeric(rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess11 = as.numeric(rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw11 = as.numeric(rdrobust(d$logpresvotes1999_1_all_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lavin99_p_s,d$margin,cluster = d$cluster,all=TRUE))
pe12 = as.numeric(rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv12 = as.numeric(rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci12 = as.numeric(rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss12 = as.numeric(rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess12 = as.numeric(rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw12 = as.numeric(rdrobust(d$lavin99_p_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lagos99_p_s,d$margin,cluster = d$cluster,all=TRUE))
pe13 = as.numeric(rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv13 = as.numeric(rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci13 = as.numeric(rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss13 = as.numeric(rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess13 = as.numeric(rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw13 = as.numeric(rdrobust(d$lagos99_p_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$nulo99_p_s,d$margin,cluster = d$cluster,all=TRUE))
pe14 = as.numeric(rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv14 = as.numeric(rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci14 = as.numeric(rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss14 = as.numeric(rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess14 = as.numeric(rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw14 = as.numeric(rdrobust(d$nulo99_p_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$blanco99_p_s,d$margin,cluster = d$cluster,all=TRUE))
pe15 = as.numeric(rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv15 = as.numeric(rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci15 = as.numeric(rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss15 = as.numeric(rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess15 = as.numeric(rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw15 = as.numeric(rdrobust(d$blanco99_p_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$unemployment_2003_s,d$margin,cluster = d$cluster,all=TRUE))  
pe16 = as.numeric(rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv16 = as.numeric(rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci16 = as.numeric(rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss16 = as.numeric(rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess16 = as.numeric(rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw16 = as.numeric(rdrobust(d$unemployment_2003_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$wage_2003_s,d$margin,cluster = d$cluster,all=TRUE))     
pe17 = as.numeric(rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv17 = as.numeric(rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci17 = as.numeric(rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss17 = as.numeric(rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess17 = as.numeric(rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw17 = as.numeric(rdrobust(d$wage_2003_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$inequality_2003_s,d$margin,cluster = d$cluster,all=TRUE))    
pe18 = as.numeric(rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv18 = as.numeric(rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci18 = as.numeric(rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss18 = as.numeric(rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess18 = as.numeric(rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw18 = as.numeric(rdrobust(d$inequality_2003_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,cluster = d$cluster,all=TRUE))
pe19 = as.numeric(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv19 = as.numeric(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci19 = as.numeric(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss19 = as.numeric(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess19 = as.numeric(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw19 = as.numeric(rdrobust(d$lag_fndr_selected_ares_dflctr_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_lag_homicide_rate_s,d$margin,cluster = d$cluster,all=TRUE))
pe20 = as.numeric(rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv20 = as.numeric(rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci20 = as.numeric(rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss20 = as.numeric(rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess20 = as.numeric(rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw20 = as.numeric(rdrobust(d$lag_homicide_rate_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_rape_rate_s,d$margin,cluster = d$cluster,all=TRUE))
pe21 = as.numeric(rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv21 = as.numeric(rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci21 = as.numeric(rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss21 = as.numeric(rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess21 = as.numeric(rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw21 = as.numeric(rdrobust(d$lag_rape_rate_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_assault_rate_s,d$margin,cluster = d$cluster,all=TRUE))
pe22 = as.numeric(rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv22 = as.numeric(rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci22 = as.numeric(rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss22 = as.numeric(rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess22 = as.numeric(rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw22 = as.numeric(rdrobust(d$lag_assault_rate_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_theft_rate_s,d$margin,cluster = d$cluster,all=TRUE))
pe23 = as.numeric(rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv23 = as.numeric(rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci23 = as.numeric(rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss23 = as.numeric(rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess23 = as.numeric(rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw23 = as.numeric(rdrobust(d$lag_theft_rate_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_robbery_rate_s,d$margin,cluster = d$cluster,all=TRUE))
pe24 = as.numeric(rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv24 = as.numeric(rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci24 = as.numeric(rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss24 = as.numeric(rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess24 = as.numeric(rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw24 = as.numeric(rdrobust(d$lag_robbery_rate_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

summary(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,cluster = d$cluster,all=TRUE))
pe25 = as.numeric(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$Estimate[1])
pv25 = as.numeric(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$pv[3])
ci25 = as.numeric(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$ci[3,])
oss25 = as.numeric(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[1] + rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N[2])
ess25 = as.numeric(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[1] + rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$N_h[2])
bw25 = as.numeric(rdrobust(d$lag_robbery_surprise_rate_s,d$margin,all=TRUE,cluster = d$cluster)$bws[1,1])

pe = c(pe1,pe2,pe3,pe4,pe5,pe6,pe7,pe8,pe9,pe10,pe11,pe12,pe13,pe14,pe15,pe16,pe17,pe18,pe19,pe20,pe21,pe22,pe23,pe24,pe25)
pv = c(pv1,pv2,pv3,pv4,pv5,pv6,pv7,pv8,pv9,pv10,pv11,pv12,pv13,pv14,pv15,pv16,pv17,pv18,pv19,pv20,pv21,pv22,pv23,pv24,pv25)
ci_lower = c(ci1[1],ci2[1],ci3[1],ci4[1],ci5[1],ci6[1],ci7[1],ci8[1],ci9[1],ci10[1],ci11[1],ci12[1],ci13[1],ci14[1],ci15[1],ci16[1],ci17[1],ci18[1],ci19[1],ci20[1],ci21[1],ci22[1],ci23[1],ci24[1],ci25[1])
ci_upper = c(ci1[2],ci2[2],ci3[2],ci4[2],ci5[2],ci6[2],ci7[2],ci8[2],ci9[2],ci10[2],ci11[2],ci12[2],ci13[2],ci14[2],ci15[2],ci16[2],ci17[2],ci18[2],ci19[2],ci20[2],ci21[2],ci22[2],ci23[2],ci24[2],ci25[2])
oss = c(oss1,oss2,oss3,oss4,oss5,oss6,oss7,oss8,oss9,oss10,oss11,oss12,oss13,oss14,oss15,oss16,oss17,oss18,oss19,oss20,oss21,oss22,oss23,oss24,oss25)
ess = c(ess1,ess2,ess3,ess4,ess5,ess6,ess7,ess8,ess9,ess10,ess11,ess12,ess13,ess14,ess15,ess16,ess17,ess18,ess19,ess20,ess21,ess22,ess23,ess24,ess25)
bw = c(bw1,bw2,bw3,bw4,bw5,bw6,bw7,bw8,bw9,bw10,bw11,bw12,bw13,bw14,bw15,bw16,bw17,bw18,bw19,bw20,bw21,bw22,bw23,bw24,bw25)
variable = c("Capital",
             "Region",
             "Province",
             "Area",
             "Population",
             "Urban",
             "Literacy",
             "Income",
             "HDI",
             "HDR",
             "Votes",
             "Right-wing",
             "Left-wing",
             "Invalid",
             "Blank",
             "Unemployment",
             "Wage income",
             "Inequality",
             "Lagged RDF Security",
             "Lagged Homicides",
             "Lagged Rape",
             "Lagged Assault",
             "Lagged Theft",
             "Lagged Robbery",
             "Lagged Robbery by surprise")
data = data.frame(variable,pe,pv,ci_lower,ci_upper,oss,ess,bw)

colnames(data) = c("","Point Estimate","Robust P-value","Robust 95% Confidence Interval lower bound","Robust 95% Confidence Interval upper bound","Overall sample size","Effective sample size","MSE bandwidth")
data

stargazer(data, summary=FALSE, rownames=FALSE, out="~/Dropbox/Crime Chile/11_replication/tableA1.html")

sink()
